package service;


import java.util.List;

import dao.StudentDAO;
import entity.Student;


public class StudentService {
	private StudentDAO studentDAO=new StudentDAO();

	public Student findById(Integer id) {
		return studentDAO.findById(id);
	}

	public List<Student> findAll() {
		return studentDAO.findAll();
	}

	public void delete(Integer id) {
		studentDAO.delete(id);
	}
	public void save(Student student) {
		Integer id=student.getId();
		if(id==null) {
			studentDAO.insert(student);
		}else {
			studentDAO.update(student);
		}
	}
	public void delete(Student student) {
		studentDAO.delete(student.getId());
	}
	public Student findByUsernameAndPassword(String stuNo,String password) {
		return studentDAO.findByUsernameAndPassword(stuNo, password);
	}
	public List<Student> findByTbClassId(Integer id) {
		return studentDAO.findByTbClassId(id);
}

	public Student findByStuNoAndPassword(String stuNo, String password) {
		
		return studentDAO.findByStuNoAndPassword(stuNo,password);
	}
}